﻿#pragma once
#include <string>
#include <list>
#include <sstream>
#include <vector>
#include <map>
#include "cocos2d.h"
#include "TableReader.h"

USING_NS_CC;
using namespace std;

class GameMusic
{
public:
	GameMusic(){};
	~GameMusic(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string music_dir;
};
class GameMusicTable : public TableReader
{
public:
	GameMusicTable() {  }
	~GameMusicTable() { purge(); }
	bool init(){ init("GameMusic.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _GameMusicList.clear(); };
	const GameMusic* getGameMusicByID(int id) { return _GameMusicList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, GameMusic*> _GameMusicList;
};

class GameEffect
{
public:
	GameEffect(){};
	~GameEffect(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string effect_dir;
};
class GameEffectTable : public TableReader
{
public:
	GameEffectTable() {  }
	~GameEffectTable() { purge(); }
	bool init(){ init("GameEffect.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _GameEffectList.clear(); };
	const GameEffect* getGameEffectByID(int id) { return _GameEffectList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, GameEffect*> _GameEffectList;
};

class UTFtest
{
public:
	UTFtest(){};
	~UTFtest(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string data;
};
class UTFtestTable : public TableReader
{
public:
	UTFtestTable() {  }
	~UTFtestTable() { purge(); }
	bool init(){ init("UTFtest.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _UTFtestList.clear(); };
	const UTFtest* getUTFtestByID(int id) { return _UTFtestList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, UTFtest*> _UTFtestList;
};

class GBtest
{
public:
	GBtest(){};
	~GBtest(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	string data;
};
class GBtestTable : public TableReader
{
public:
	GBtestTable() {  }
	~GBtestTable() { purge(); }
	bool init(){ init("GBtest.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _GBtestList.clear(); };
	const GBtest* getGBtestByID(int id) { return _GBtestList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, GBtest*> _GBtestList;
};

class TestDataOne
{
public:
	TestDataOne(){};
	~TestDataOne(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	int data1;
	float data2;
	string data3;
	double data4;
	unsigned int data5;
};
class TestDataOneTable : public TableReader
{
public:
	TestDataOneTable() {  }
	~TestDataOneTable() { purge(); }
	bool init(){ init("TestDataOne.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _TestDataOneList.clear(); };
	const TestDataOne* getTestDataOneByID(int id) { return _TestDataOneList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, TestDataOne*> _TestDataOneList;
};

class TestDataTwo
{
public:
	TestDataTwo(){};
	~TestDataTwo(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	int data1;
	float data2;
	string data3;
	double data4;
	unsigned int data5;
};
class TestDataTwoTable : public TableReader
{
public:
	TestDataTwoTable() {  }
	~TestDataTwoTable() { purge(); }
	bool init(){ init("TestDataTwo.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _TestDataTwoList.clear(); };
	const TestDataTwo* getTestDataTwoByID(int id) { return _TestDataTwoList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, TestDataTwo*> _TestDataTwoList;
};

class TestDataThree
{
public:
	TestDataThree(){};
	~TestDataThree(){};
	void readline(std::stringstream& _stream);
	unsigned int key;
	int data1;
	float data2;
	string data3;
	double data4;
	unsigned int data5;
};
class TestDataThreeTable : public TableReader
{
public:
	TestDataThreeTable() {  }
	~TestDataThreeTable() { purge(); }
	bool init(){ init("TestDataThree.csv"); return true; };
	void init(const std::string& filename) { parse(filename, 3); }
	void purge(){ _TestDataThreeList.clear(); };
	const TestDataThree* getTestDataThreeByID(int id) { return _TestDataThreeList[id];};
private:
	virtual void readline(std::stringstream& _stream);
	std::map<unsigned int, TestDataThree*> _TestDataThreeList;
};

